package com.mbengue.corp.apr.ra.beans;

import java.io.Serializable;
import java.util.List;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import com.mbengue.corp.apr.ra.rss.FeedMessage;
import com.mbengue.corp.apr.ra.rss.RSSFeedParser;

@ManagedBean(name = "rssBean")
@SessionScoped
public class RssBean implements Serializable {
  private static final long serialVersionUID = 1L;
  private List<FeedMessage> feeds;

  public RssBean() {
    String feedUrl = "http://news.google.sn/news?pz=1&cf=all&ned=fr_sn&hl=fr&topic=n&output=rss";
    System.setProperty("http.proxyHost", "10.155.1.10");
    System.setProperty("http.proxyPort", "8080");
    RSSFeedParser rssParser = new RSSFeedParser(feedUrl);
    feeds = rssParser.readFeed();
  }

  public List<FeedMessage> getFeeds() {
    return feeds;
  }
}
